package com.lantosec.hmrp.modules.eval.controller.app;


import com.lantosec.hmrp.core.kit.Result;
import com.lantosec.hmrp.core.log.ControllerLog;
import com.lantosec.hmrp.core.log.LogType;
import com.lantosec.hmrp.core.mvc.BaseController;
import com.lantosec.hmrp.modules.eval.entity.EvalDetailed;
import com.lantosec.hmrp.modules.eval.service.IEvalDetailedService;
import com.lantosec.hmrp.modules.eval.vo.EvalDetailedVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


/**
 * 考评明细 控制器
 *
 * @author AutoCode
 * @since 2020-03-30
 */
@Api(value = "考评明细控制器APP端", tags = "考评明细控制器APP端")
@RestController
@RequestMapping("/eval/app/detailed")
@Log4j2
public class EvalDetailedAppController extends BaseController {
    @Autowired
    private IEvalDetailedService service;


    @PutMapping("update")
    @ControllerLog(name = "修改考评明细", type = LogType.update)
    @ApiOperation(value = "修改数据")
    public Result<Void> update(@ApiParam(value = "考评明细VO对象", required = true) @RequestBody EvalDetailedVO vo) {
        EvalDetailed entity = vo.convertToEntity();
        service.updateById(entity);
        return Result.ok();
    }

    @GetMapping("get/{evalDetailedId}")
    @ApiOperation(value = "主键查询")
    public Result<EvalDetailedVO> get(@ApiParam(value = "evalDetailedId", required = true) @PathVariable(name = "evalDetailedId") String evalDetailedId) {
        EvalDetailedVO evalDetailedVO = service.get(evalDetailedId);
        return Result.ok(evalDetailedVO);
    }
}
